package net.app.zoneland.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import net.app.zoneland.system.entity.SysUser;
import net.app.zoneland.system.service.ISysUserService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author LENOVO
 * @CreateTime 2020/12/27 17:50
 * @Version: 1.0
 */
@Service
@AllArgsConstructor
public class UserDetailsServiceImpl implements UserDetailsService {

    private final ISysUserService sysUserService;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        SysUser userEntity = sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, username));
       // String password = userEntity.getPassword();
       // password="{noop}"+password;
      //  userEntity.setPassword(password);
        System.out.println(userEntity);
        return userEntity;
    }

}
